package NG::Chat::Client::Admin;
use strict;
use warnings;

use JSON::XS;
use Queue::Mmap;
use NG::Sys::Cfg;


sub new {
    my $class = shift;
	my $app = shift;
	my $c = config("chat_admin");
	my $q = new Queue::Mmap(
		file => $app->{cfg}{path}{cache}."/".$c->{queue}{file},
		queue => $c->{queue}{queue},
		length => $c->{queue}{length},
	);
    my $self = bless {'q' => $q}, $class;
    return $self;
}
sub send_message {
	my $self = shift;
	my $obj = shift;
	$self->{q}->push(encode_json($obj));
}

1;
